Ext.define('AmpleHarvest.objects.forms.irtCommon.requestInformation.requestCommon.requestGeneral',
{
	extend			: 'Ext.form.Panel',
	alias			: 'widget.ampleharvest-objects-forms-irtcommon-requestinformation-requestcommon-requestgeneral',
	requires		:
	[
		"Ext.form.field.Text", 
		"Ext.form.FieldSet",
		"Ext.form.field.Date", 
		'Ext.layout.container.VBox',
		'Ext.layout.container.HBox',
	],
		
	statics			: {},
	
	initComponent	: function()
	{
		
		this.generalRequstInfoVBox = Ext.create('Ext.Panel', 
		{
		    border: false,
			defaultType: 'textfield',
		    layout: 
		    {
		        type: 'vbox',
		        align: 'left'
		    }
		});
		
		
		//-------------------- General --------------------//
		this.generalRequstInfo = Ext.create('Ext.Panel', 
		{
		    border: false,
			defaultType: 'textfield',
		    layout: 
		    {
		        type: 'vbox',
		        align: 'left'
		    },
		    items: [
		            {
			            fieldLabel: 'Website Title/Name',
			            name: 'website_name', //PHP Column label
			            disabled : false,		
			            labelAlign: 'right',
			            labelWidth: 120,
			            itemId: 'websitetitle_textfield',
						allowBlank	: false
		            }, 
		            {
			            fieldLabel: 'Originating URL',
			            name: 'url', //PHP Column label
			            disabled : false,
			            labelAlign: 'right',
			            labelWidth: 120,
			            itemId: 'originatingurl_textfield',
						allowBlank	: false
		            }
		        ]
		});
		
				
		//-------------------- Frequency --------------------//
		this.requestFrequency = Ext.create('AmpleHarvest.objects.forms.irtCommon.requestInformation.requestCommon.requestFrequency',
		{
			flex	: 1.2,
			border	: false
		});
		

		//-------------------- Requested Resource --------------------//
		this.requestedResource = Ext.create("Ext.form.FieldSet",
		{
			title		: "Requested Resource",
			collapsible	: false,
			labelWidth	: 70,
			width		: 275,
			layout		: 
			{
				type	: 'vbox'
			}
		});
		
		this.requestedResourceVBox = Ext.create('Ext.Panel', 
		{ 
			border		: false,
			layout		: 
			{
				type	: 'vbox',
				align	: 'left'
			},
			items: [
	        {
	        	xtype : 'checkboxgroup',
	        	allowBlank : false,
	            defaultType : 'radiofield',
	            defaults :  { flex	: 1 },
	            layout: 'vbox',
	            items: 
	            [
	                {
	                    boxLabel  : 'Web Page/File',
			            name: 'requested_resource', //PHP Column label
	                    inputValue: 'webpage_file'
	                },
	                {
	                    boxLabel  : 'Message Board',
			            name: 'requested_resource', //PHP Column label
	                    inputValue: 'messageboard',
	                    disabled	: true
	                },
	                {
	                    boxLabel  	: 'RSS Feed',
			            name: 'requested_resource', //PHP Column label
	                    inputValue	: 'rssfeed',
	                    disabled	: true
	                },
               ]
           }]
		});	
		
		this.requestedResource.add( this.requestedResourceVBox );		

		//-------------------- OPSEC Concerns --------------------//
		this.opsecConcerns = Ext.create("Ext.form.FieldSet",
		{
			title		: "OPSEC Concerns",
			collapsible	: false,
			labelWidth	: 70,
			width		: 275,
			items: [
			{
				xtype : 'checkboxgroup',
				allowBlank : false,
			    defaultType		: 'radiofield',
			    defaults		: 
			    {
			        flex	: 1
			    },
			    layout			: 
			    {
			    	type		: 'vbox'
			    },
			    
			    items: 
			    [
			        {
			            boxLabel	: 'High',
			            name: 'opsec_concerns', //PHP Column label
			            inputValue	: 'high'
			        },
			        {
			            boxLabel	: 'Medium',
			            name: 'opsec_concerns', //PHP Column label
			            inputValue	: 'medium'
			        },
			        {
			            boxLabel	: 'Low',
			            name: 'opsec_concerns', //PHP Column label
			            inputValue	: 'low'
			        },
			        {
			            boxLabel	: 'None',
			            name: 'opsec_concerns', //PHP Column label
			            inputValue	: 'none'
			        },
			   ]
			}]
		});

		//-------------------- Primary Language --------------------//

		this.primaryLanguage = Ext.create("Ext.form.FieldSet",
		{
			title		: "Primary Language",
			collapsible	: false,
			labelWidth	: 70,
			width		: 275,
			boxMinHeight: 120,
			height		: 120,
			items: [
			{
	            xtype : 'checkboxgroup',
	            allowBlank : false,
			    defaultType		: 'radiofield',
			    defaults		: 
			    {
			        flex	: 1
			    },
			    layout: 'vbox',
			    items: 
			    [
			        {
			            boxLabel  : 'English',
			            name: 'language', //PHP Column label
			            inputValue: 'english',
	                    handler: function(checkbox, checked) {
	                		if(checked){
		                		this.ownerCt.getComponent('foreignlanguage_textfield').hide();
		                		this.ownerCt.getComponent('foreignlanguage_textfield').disable();
	                		}
	                	}
			        },
			        {
			            boxLabel  	: 'Foreign',
			            name: 'language', //PHP Column label
			            inputValue	: 'foreign',
	                    handler		: function(checkbox, checked) {
	                		if(checked){
		                		this.ownerCt.getComponent('foreignlanguage_textfield').enable();
		                		this.ownerCt.getComponent('foreignlanguage_textfield').show();
	                		}
	                	}
			        }, 
		            {
		            	xtype 		: 'textfield',
			            fieldLabel	: 'Foreign Language',
			            name: 'foreign_language', //PHP Column label
			            layout		: 
					    {
							type	: 'vbox',
							align	: 'left'
						},
			            hidden 		: true,		
			            labelWidth	: 110,
			            itemId		: 'foreignlanguage_textfield',
						allowBlank	: false
		            }, 
			   ]
			}]
		});

		//-------------------- Key Words--------------------//
		this.importKeyWords = Ext.create(
			"Ext.form.FieldSet",
			{
				title : "Key Words",
				collapsible : false,
				labelWidth : 70,
				width : 275,
				layout :  { type : 'vbox' },
				items : [
			        {
					    xtype     : 'textarea',
					    grow      : true,
			            name: 'key_words', //PHP Column label
					    anchor    : '100%',
					    width		: 250,
						allowBlank	: false
					}
		        ]
			}
		);
		
		this.generalRequstInfoVBox.add(this.generalRequstInfo);	
		this.generalRequstInfoVBox.add(this.requestFrequency);
		this.generalRequstInfoVBox.add(this.requestedResource);	
		this.generalRequstInfoVBox.add(this.opsecConcerns);	
		this.generalRequstInfoVBox.add(this.primaryLanguage);
		this.generalRequstInfoVBox.add(this.importKeyWords);
		
		this.items = [ 	this.generalRequstInfoVBox ]
		
	    this.callParent();
	}
});